export class DataStore {
    static getInstance() {
        if (!DataStore.instance) {
            DataStore.instance = new DataStore();
        }
        return DataStore.instance;
    }

    constructor() {
        this.spriteMap = new Map();
    }

    put(key, value) {
        if(typeof value === 'function') {
            value = new value();
        }
        this.spriteMap.set(key, value);
        return this;
    }

    get(key) {
        return this.spriteMap.get(key);
    }

    destroy() {
        this.spriteMap.clear();
    }

}